<?php
/**
 * Created by PhpStorm.
 * User: 1
 * Date: 2017-03-17
 * Time: 15:37
 */

namespace app\src\sunsun\server\action;

use GatewayClient\Gateway;


/**
 * Class SServerClientAction
 * tcp 客户端通用操作
 * @package app\src\sunsun\heatingRod
 */
class SServerClientAction extends SServerBaseAction
{
    /**
     * 获取在线设备数量，分组
     * @param string $group
     * @return int
     */
    public function allClientCountByGroup($group = '')
    {
        return Gateway::getClientCountByGroup($group);
    }

    /**
     * 获取设备信息
     * @return int
     */
    public function allClientCount()
    {
        return Gateway::getAllClientCount();
    }

    public function getSession($did)
    {
        $client_id = Gateway::getClientIdByUid($did);
        if (count($client_id) > 0) {
            return Gateway::getSession($client_id[0]);
        }

        return null;
    }


}